package com.ruoyi.cert.service.impl;

import java.util.List;
        import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cert.mapper.CertTypeMapper;
import com.ruoyi.cert.domain.CertType;
import com.ruoyi.cert.service.ICertTypeService;

/**
 * 证书类型Service业务层处理
 *
 * @author mxh
 * @date 2023-03-26
 */
@Service
public class CertTypeServiceImpl implements ICertTypeService {
    @Autowired
    private CertTypeMapper certTypeMapper;

    /**
     * 查询证书类型
     *
     * @param id 证书类型主键
     * @return 证书类型
     */
    @Override
    public CertType selectCertTypeById(Long id) {
        return certTypeMapper.selectCertTypeById(id);
    }

    /**
     * 查询证书类型列表
     *
     * @param certType 证书类型
     * @return 证书类型
     */
    @Override
    public List<CertType> selectCertTypeList(CertType certType) {
        return certTypeMapper.selectCertTypeList(certType);
    }

    /**
     * 新增证书类型
     *
     * @param certType 证书类型
     * @return 结果
     */
    @Override
    public int insertCertType(CertType certType) {
        certType.setCreateBy(SecurityUtils.getUsername());
        certType.setCreateTime(DateUtils.getNowDate());
        return certTypeMapper.insertCertType(certType);
    }

    /**
     * 修改证书类型
     *
     * @param certType 证书类型
     * @return 结果
     */
    @Override
    public int updateCertType(CertType certType) {
        certType.setUpdateBy(SecurityUtils.getUsername());
                certType.setUpdateTime(DateUtils.getNowDate());
        return certTypeMapper.updateCertType(certType);
    }

    /**
     * 批量删除证书类型
     *
     * @param ids 需要删除的证书类型主键
     * @return 结果
     */
    @Override
    public int deleteCertTypeByIds(Long[] ids) {
        return certTypeMapper.deleteCertTypeByIds(ids);
    }

    /**
     * 删除证书类型信息
     *
     * @param id 证书类型主键
     * @return 结果
     */
    @Override
    public int deleteCertTypeById(Long id) {
        return certTypeMapper.deleteCertTypeById(id);
    }
}
